﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using PokemonBattle.PokemonData.Util;

namespace PokemonBattle.PokemonData.SQLite.DAL
{
    public static class DALMoveLearnData
    {
        public static List<MoveLearnData> GetByPmId(int pmId)
        {
            string sql = "select * from V_MoveLearnData where pmid=" + pmId;
            var dt = DbHelperSQLite.ExecuteDataTable(sql);
            var list = from DataRow dr in dt.Rows
                       select DataRowToModel(dr);
            return list.ToList();
        }

        public static MoveLearnData DataRowToModel(DataRow row)
        {
            var data = new MoveLearnData();

            data.MoveName = row["name"].ToString();
            data.Info = row["Info"].ToString();
            data.LearnBy = row["LearnBy"].ToString();
            data.WithoutTrait = (Trait)row["WithoutTraitId"].ToString().ToInt();

            return data;
        }
    }
}
